/* See the file "LICENSE" for the full license governing this code. */

package com.plugandcare.graphyty.model;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Data model of blood pressure in mm[Hg]. Modeled using the OpenEHR archetype
 * openEHR-EHR-OBSERVATION.blood_pressure.v1.
 * 
 * @author Steven Mohr
 */
public class BloodPressure extends VitalSign{
    /** Constant for unit "mmHg". **/
    public static final String UNIT_MMHG = "mmHg";

    private double systolicPressure;

    private double diastolicPressure;

    private double pulsePressure;


    public double getSystolicPressure() {
        return systolicPressure;
    }

    public void setSystolicPressure(double systolicPressure) {
        this.systolicPressure = systolicPressure;
    }

    public double getDiastolicPressure() {
        return diastolicPressure;
    }

    public void setDiastolicPressure(double diastolicPressure) {
        this.diastolicPressure = diastolicPressure;
    }

    public double getPulsePressure() {
        return pulsePressure;
    }

    public void setPulse(double newPulse) {
        this.pulsePressure = newPulse;
    }

    /**
     * {@inheritDoc}
     */
    public String toString() {
        return "Systolic: " + String.valueOf(systolicPressure) + " " + unit + ", "
                + "Diastolic: " + String.valueOf(diastolicPressure) + " " + unit + ", "
                + "Pulse: " + String.valueOf(pulsePressure) + " bpm "
                + "(@" + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(timestamp)) + ")";
    }
    
    @Override
    public String getMeasurement() {
        return systolicPressure + " " + unit;
    }
}
